package main

import (
	maker2 "api/libs/maker"
	"gitee.com/dreamwood/ez-maker/maker"
)

func main() {
	maker2.Prepare()
	Role()
	Department()
	Job()
}

func Role() {
	c := maker.CreateTable("Role", "角色", "auth")
	c.AddName()
	c.AddText("group", "分组").SetDesc("方便进行分组")
	c.AddText("key", "KEY值").SetDesc("存储关键字")
	c.AddManyToMany("pages", "页面权限", "Page").SetIsControl(true)
	c.AddManyToMany("apis", "接口权限", "Api").SetIsControl(true)
	c.AddManyToMany("models", "模块权限", "Model").SetIsControl(true)
	//载入分类树模型,实现继承关系
	c.LoadTree()
	c.Generate()
}

func Department() {
	c := maker.CreateTable("Department", "部门", "auth")
	c.AddText("name", "名称")
	c.AddText("code", "编码")
	c.AddText("codeLink", "编码链")
	//载入分类树模型,实现继承关系
	c.LoadTree()
	c.Generate()
}

func Job() {
	c := maker.CreateTable("Job", "岗位", "auth")
	c.AddText("name", "名称")
	c.AddText("code", "编码").SetDesc("一般设置一个2位的编码,特别复杂的情况设置三位")
	c.AddText("codeLink", "编码链").SetDesc("根据继承关系，把编码穿起来，形成自身编码，如A部门02，A部门下a1部门01，则此处为0201")
	//载入分类树模型,实现继承关系
	c.LoadTree()
	c.Generate()
}
